﻿#ifndef __RM_H__
#define __RM_H__
#include "Global.h"
#include "Texture.h"
#include "Surface.h"
#include "Sound.h"

#include "Sprite.h"
#include <vector>
using namespace std;


enum ResourceID
{
	RESOURCE__GAMEPLAY_MAP,
	RESOURCE_MARIO,
};

struct SoundName
{
	char* EnemyDie;
	char* BrickBroken;
	char* ExtraLife;
	char* FinishMap;
	char* GameOver;
	char* GetCoin;
	char* HeadShoot;
	char* Jump;
	char* LevelUp;
	char* LevelDown;
	char* MenuChange;
	char* PlayerDie;
	char* Pause;
	char* Tube;
	char* Shoot;
	char* BonusTime;
	char* DonutPlains;
	char* BackGround;
	char* Secret;
	char* MenuMusic;
};

struct TextureName
{
	LPWSTR Bullet;
	LPWSTR Mario_Big;
	LPWSTR Mario_Bullet;
	LPWSTR Mario_Small;
	LPWSTR Mario_Small_Light;
	LPWSTR BrickAll;
	LPWSTR Transparent;
	LPWSTR Brick;
	LPWSTR Brick_Explosion;
	LPWSTR Grass_Left;
	LPWSTR Grass_Middle;
	LPWSTR Grass_Right;
	LPWSTR Turtle_Green;
	LPWSTR Stone;
	LPWSTR Question;
	LPWSTR Question_Empty;
	//LPWSTR Coin;
	LPWSTR EndPoint;
	//LPWSTR Brick_Coin;
	LPWSTR Score;
	LPWSTR Item;
	LPWSTR Flower;
	LPWSTR LifeMushroom;
	LPWSTR MushroomRed;
	LPWSTR Star;
	LPWSTR Canon;
	LPWSTR Goomba;
	LPWSTR Piranha;
	LPWSTR Bush;
	LPWSTR Cloud;
	LPWSTR Fence_Left;
	LPWSTR Fence_Middle;
	LPWSTR Fence_Right;
	LPWSTR Tree_Bottom;
	LPWSTR Tree_Middle;
	LPWSTR Tree_Top;
	LPWSTR Tree_Small;
	LPWSTR Trunk;
	LPWSTR Pipe_H_Left;
	LPWSTR Pipe_H_Middle;
	LPWSTR Pipe_H_Right;
	LPWSTR Pipe_V_Top;
	LPWSTR Pipe_V_Middle;
	LPWSTR Pipe_V_Bottom;
	LPWSTR Ground_Left;
	LPWSTR Ground_Middle;
	LPWSTR Ground_Right;
	LPWSTR Mario;

	LPWSTR Grass_Left_2;
	LPWSTR Grass_Middle_2;
	LPWSTR Grass_Right_2;
	LPWSTR Ground_Left_2;
	LPWSTR Ground_Middle_2;
	LPWSTR Ground_Right_2;
	LPWSTR Pipe_H_Left_2;
	LPWSTR Pipe_H_Middle_2;
	LPWSTR Pipe_H_Right_2;
	LPWSTR Pipe_V_Bottom_2;
	LPWSTR Pipe_V_Middle_2;
	LPWSTR Pipe_V_Top_2;
	LPWSTR Stone_2;
	LPWSTR Fence_Left_3;
	LPWSTR Fence_Middle_3;
	LPWSTR Fence_Right_3;
	LPWSTR Grass_Left_3;
	LPWSTR Grass_Middle_3;
	LPWSTR Grass_Right_3;
	LPWSTR Pipe_H_Left_3;
	LPWSTR Pipe_H_Middle_3;
	LPWSTR Pipe_H_Right_3;
	LPWSTR Pipe_V_Bottom_3;
	LPWSTR Pipe_V_Middle_3;
	LPWSTR Pipe_V_Top_3;
	LPWSTR Tree_Bottom_3;
	LPWSTR Tree_Middle_3;
	LPWSTR Tree_Small_3;
	LPWSTR Tree_Top_3;
	LPWSTR Infobar;

	LPWSTR MenuScene_Cursor;
	LPWSTR MenuScene_Loadmap;
	LPWSTR MenuScene_Newgame;
	LPWSTR MenuScene_Help;
	LPWSTR MenuScene_Exit;	
	LPWSTR PauseScene_Resume;
	LPWSTR PauseScene_Menu;
	LPWSTR PauseScene_Quit;
	LPWSTR PauseScene_Mute;
	LPWSTR PauseScene_Highlight;
};

struct SurfaceName
{
	LPWSTR Background;
	LPWSTR BackgroundTest;
	LPWSTR MenuScene_Background;
	LPWSTR PauseScene_Background;
	LPWSTR GameOver_Background;
};

enum MARIO_STATE
{
	MS_REMOVE,			//xoa mario
	MS_DIE,				//mario dang chet
	MS_NORMAL,			//binh thuong
	MS_SMALLTOBIG,		//trang thai chuyen tu nho den lon
	MS_BIGTOSMALL,		//trang thai chuyen tu lon den nho
	MS_BIGTOBULLET,		//trang thai chuyen tu lon den bullet
	MS_BULLETTOSMALL,	//trang thai chuyen tu bullet den nho
	MS_PROTECT,			//trang thai bao ve mario sau khi chet
	MS_HASSTAR,			//trang thai mario da an sao
	MS_CREPTPINE,		//mario chui vao cong(Pine)
	MS_GOUPPINE,		//mario chui len cong(Pine)
	MS_INTOPINE			//mario chui vao cong(Pine)
};

enum ENEMY_STATE
{
	ES_REMOVE,
	ES_NORMAL,
	ES_ACTIVING,
	ES_STOP,				//Khi Goomba hoặc Koopa bị dậm
	ES_MOVE_SHELL_LEFT,		//Khi Koopa di chuyển trong mai rùa.
	ES_MOVE_SHELL_RIGHT,
	ES_FALL,				//Khi Goomba hoặc Koopa bị rơi (chuẩn bị chết)
	ES_FALLBULLET,			//Khi Koopa bi bullet mario cham
	ES_DIED
};

enum BLOCK_STATE
{
	BS_REMOVE,		//khi gach bi vo, can xoa
	BS_NORMAL,		//trang thai binh thuong
	BS_IDLE_2,
	BS_MOVEUP,		//gach bi nhay len 1 doan khi mario doi len
	BS_BREAKING,	//gach dang bi vo
	BS_BREAKED,		//gach da vo
	BS_ACTIVING,		//cho phep object hoat dong
	BS_NONE			//gach:21 chua 5 coin
};

enum ITEM_STATE
{
	IS_REMOVE,		//trang thai can xoa
	IS_IDLE,		//trang thai binh thuong
	IS_MOVING,		//item co the di chuyen
	IS_ACTIVING,	//kich hoat item hien len
	//IS_ATE,			//item bi mario an
	IS_FREE,		//trang thai tu do
	IS_READY,		//trang thai san sang
	IS_FLOWER,		//trang thai la hoa, khong phai nam
	IS_EXPLOSION	//trang thai no cua bullet
};


class ResourceManager
{
private:
	//load all resource
	ResourceManager();

	//unique instance, dam bao chi co 1 thuc the duy nhat nam giu cac tai nguyen
	static ResourceManager* _instance;

	//-------------------- RESOURCE ----------------------
	//List of Surface
	vector<Surface*> _listSurface;
	
	//List of Texture2
	vector<Texture*>_listTexture;

	// List of Sound
	vector<Sound*>_listSound;

	

public:

	SoundName SoundName;
	TextureName TextureName;
	SurfaceName SurfaceName;

	//release all resource
	~ResourceManager(void);

	//get the unique instance, lay thuc the giu cac tai nguyen
	static ResourceManager* GetInstance();
	Sprite *GetSprite(ResourceID id);
	//get Surface, texture
	Surface* GetSurface(LPWSTR fileName);
	Texture* GetTexture(LPWSTR fileName);
	Sound* GetSound(char* Name);

	void MuteAll(bool value);
};

#endif